package dongshi.daddy.springioc.three.three_three.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * 人类实现类
 */
@Component("businessPerson")
public class BusinessPerson implements Person {
    // byType方式注入
    @Autowired
    @Qualifier("cat")
    private Animal animal = null;
/*
    @Autowired
    private Animal cat = null;
*/


    @Override
    public void service() {
        this.animal.use();
//        this.cat.use();
    }

    @Override
    public void setAnimal(Animal animal) {
        this.animal = animal;
//        this.cat = animal;
    }
}
